package com.lx.patterns.mediator;

/**
 * @ClassName MediatorStructure
 * @Description: 中介机构
 * @Author: 落雪
 * @CreateDate: 2025/2/15 10:40
 * @UpdateUser: 落雪
 * @UpdateDate: 2025/2/15 10:40
 * @UpdateRemark:
 * @Version: 1.0
 */
public class MediatorStructure extends Mediator{

    //首先中介结构必须知道所有房主和租房者的信息
    private HouseOwner houseOwner;
    private Tenant tenant;

    public HouseOwner getHouseOwner() {
        return houseOwner;
    }

    public void setHouseOwner(HouseOwner houseOwner) {
        this.houseOwner = houseOwner;
    }

    public Tenant getTenant() {
        return tenant;
    }

    public void setTenant(Tenant tenant) {
        this.tenant = tenant;
    }

    @Override
    public void contact(String message, Person person) {
        if(person == houseOwner){
            tenant.getMessage(message);
        }else {
            houseOwner.getMessage(message);
        }

    }
}
